load("//tools/build_defs/android:fb_xplat_cxx_library.bzl", "fb_xplat_cxx_library")
load("//tools/build_defs/oss:profilo_defs.bzl", "profilo_path")

fb_xplat_cxx_library(
    name = "logger",
    headers = glob(
        ["*.h"],
    ),
    header_namespace = "profilo",
    exported_headers = [
        "Logger.h",
        "Packet.h",
        "PacketLogger.h",
        "RingBuffer.h",
    ],
    compiler_flags = [
        "-fvisibility=hidden",
        "-fexceptions",
        "-std=gnu++14",
        "-DLOG_TAG=\"Profilo\"",
    ],
    visibility = [
        profilo_path("..."),
    ],
    deps = [
        profilo_path("cpp:constants"),
    ],
    exported_deps = [
        profilo_path("cpp/generated:cpp"),
        profilo_path("cpp/logger/lfrb:lfrb"),
    ],
)

fb_xplat_cxx_library(
    name = "logger_static",
    srcs = [
        "Logger.cpp",
        "PacketLogger.cpp",
        "RingBuffer.cpp",
    ],
    headers = glob(
        ["*.h"],
    ),
    header_namespace = "profilo",
    exported_headers = [
        "Logger.h",
        "Packet.h",
        "PacketLogger.h",
        "RingBuffer.h",
    ],
    compiler_flags = [
        "-fvisibility=hidden",
        "-fexceptions",
        "-std=gnu++14",
        "-O3",
        "-DLOG_TAG=\"Profilo\"",
    ],
    force_static = True,
    tests = [
        profilo_path("cpp/test:packet_logger"),
    ],
    visibility = [
        profilo_path("..."),
    ],
    deps = [
        profilo_path("cpp:constants"),
        profilo_path("cpp/generated:cpp"),
        profilo_path("cpp/logger/lfrb:lfrb"),
        profilo_path("deps/fb:fb"),
    ],
)
